import http from '@/util/request.js'

export default {
    getAdminById: (id) => {
        return http({
            url: `/api/user/id/${id}`,
            method: 'get'
        })
    },

    getAdminList: (data) => {
        return http({
            url: '/api/user/adminList',
            method: 'get',
            params: data
        })
    },

    addAdmin: (data) => {
        return http({
            url: '/api/user/addAdmin',
            method: 'post',
            data
        })
    },

    updateAdmin: (data) => {
        return http({
            url: '/api/user/updateAdmin',
            method: 'put',
            data
        })
    },

    deleteAdmin: (id) => {
        return http({
            url: `/api/user/deleteAdmin/${id}`,
            method: 'delete'
        })
    },

    getAdminPage: (current, size, data) => {
        // 修改：使用正确的路径和参数传递方式
        return http({
            url: '/api/user/adminPage',
            method: 'get',
            params: {
                current: current,
                size: size,
                ...data
            }
        })
    },

    resetPassword: (data) => {
        return http({
            url: '/api/user/resetPassword',
            method: 'put',
            data
        })
    },
}
